import { API } from './config'
import $http from './request'

// 注册
export const apiRegister = (smsCode, regPhone, regPassword, meReg) => {
  return $http.post(`${API}login/register`, { smsCode, regPhone, regPassword, meReg })
}

// 登录
export const apiLogin = (regPhone, regPassword) => {
  return $http.post(`${API}login/select`, { regPhone, regPassword })
}

// 忘记密码
export const apiForgot = (regPhone, regPassword, smsCode) => {
  return $http.post(`${API}login/revisepassword`, { regPhone, regPassword, smsCode })
}

// 获取验证码
export const apiGetCode = (key) => {
  return $http.get(`${API}login/sendcode`, { key })
}

// 校验验证码
export const apiCheckCode = (key, value) => {
  return $http.post(`${API}login/checkcode`, { key, value })
}

// 发送短信验证码
export const apiSendMsgCode = {
  // 注册时，发送短信验证码
  registerCode(regPhone) {
    return $http.post(`${API}login/sendsmscode`, { regPhone })
  },
  // 忘记密码时，发送短信验证码
  forgotCode(regPhone) {
    return $http.post(`${API}login/checkPhone`, { regPhone })
  }
}

// 融资申请
// export const apiFinanceApply = {
//   // 
// }